package com.jy.wms.controller;

import com.jy.wms.service.CxfInventoryPlanService;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.xml.ws.Endpoint;

@Configuration
public class CxfInventoryPlanController {

    @Autowired
    private Bus bus;

    @Autowired
    CxfInventoryPlanService cxfInventoryPlanService;

    /** JAX-WS **/
    @Bean
    public SpringBus springBus() {
        return new SpringBus();
    }
    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(bus, cxfInventoryPlanService);
        endpoint.publish("/cxfInventoryPlan");
        return endpoint;
    }
}
